#ifndef PARSER_H
#define PARSER_H

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <strings.h>
#include <cstring>


using namespace std;

/**
 * \brief Parser creator
 *
 * This class provides a Robocup parser
 */

class Parser
{

public:


    unsigned int stamina;/** Energy level . */ //(stamina Stamina Effort)
    unsigned int effort; /** Effort. */
    int clock;
    float speed [2] /** Speed and angle of running. */;//(speed Speed Angle)
    int head_angle; /** The angle btw the neck and the body of the player. */ //(head_angle Angle)

    vector <int> counters; /** This vector keeps the number of invoked actions.*///(kick dash turn say turn_neck catch move change_view)

    //tags

    float p_id[1];
    float player[6];
    string team_name;

    float ball[6]; /** Ball relative position from the player. */
    float line_r[6]; /** Relative position of the right line football field from the player. */ //línea derecha
    float line_l[6]; /** Relative position of the left line football field from the player. */ //línea izquierda


    float flag_c[6]; /** Flag c relative position from the player. */ //centro
    float flag_c_t [6]; /** Flag c t relative position from the player. *///centro arriba
    float flag_c_b [6]; /** Flag c b relative position from the player. */ //centro

    float flag_r_t [6];
    float flag_r_b [6];

    float flag_g_l_t [6]; /** Flag g l t relative position from the player. *///portería izq arriba
    float goal_l[6]; /** Left goal relative position from the player. *///portería izquierda
    float flag_g_l_b [6]; /** Flag g l b relative position from the player. *///portería izq abajo

    float flag_g_r_t [6]; /** Flag g r t relative position from the player. *///portería dcha arriba
    float goal_r[6]; /** Right goal relative position from the player. *///portería derecha
    float flag_g_r_b [6];/** Flag g r b relative position from the player. *///portería dcha abajo

    unsigned int time;

    //Miscellaneous xD
    bool objectball; /** Boolean variable to check if we have seen the ball in this cycle. */

    //functions

    Parser();
    void parse (string &data);
    void findplayer(string &str, const string name, float id[], string &team, float see_info[]);
    void findfloats(string &str, const string name, float see_info[]);
    int  findint(string &str, const string name);
    void findint2(string &str, const string name, int values[]);
    void findint2(string &str, const string name, unsigned int &value1, unsigned int &value2); //sobrecarga
    string  findstring(string &str, const string name);
};

#endif // PARSER_H
